package org.springonrails.template;

import java.io.File;

import freemarker.template.Template;

public class BuiltInFreeMarkerTemplateDef implements TemplateDef {

	
	private boolean applyToEachEntity;
	private File outputDirectory;
	private String sourceFileNamePrefix;
	private String sourceFileNameSuffix;
	private String sourceFileNameExtension;	
	private Template freeMarkerTemplate;

	public BuiltInFreeMarkerTemplateDef(){}
	
	
	public BuiltInFreeMarkerTemplateDef(boolean applyToEachEntity,
			File outputDirectory, String sourceFileNamePrefix,
			String sourceFileNameSuffix, String sourceFileNameExtension,
			Template freeMarkerTemplate) {
		super();
		this.applyToEachEntity = applyToEachEntity;
		this.outputDirectory = outputDirectory;
		this.sourceFileNamePrefix = sourceFileNamePrefix;
		this.sourceFileNameSuffix = sourceFileNameSuffix;
		this.sourceFileNameExtension = sourceFileNameExtension;
		this.freeMarkerTemplate = freeMarkerTemplate;
	}

	public boolean isApplyToEachEntity() {
		return applyToEachEntity;
	}

	public void setApplyToEachEntity(boolean applyToEachEntity) {
		this.applyToEachEntity = applyToEachEntity;
	}

	public File getOutputDirectory() 
	{
		if(outputDirectory==null) return new File(".");		
		return outputDirectory;
	}

	public void setOutputDirectory(File outputDirectory) {
		this.outputDirectory = outputDirectory;
	}

	public String getSourceFileNamePrefix() {
		if(sourceFileNamePrefix==null) sourceFileNamePrefix="";
		return sourceFileNamePrefix;
	}

	public void setSourceFileNamePrefix(String sourceFileNamePrefix) {
		this.sourceFileNamePrefix = sourceFileNamePrefix;
	}

	public String getSourceFileNameSuffix() {
		if(sourceFileNameSuffix==null)sourceFileNameSuffix="";
		return sourceFileNameSuffix;
	}

	public void setSourceFileNameSuffix(String sourceFileNameSuffix) {
		this.sourceFileNameSuffix = sourceFileNameSuffix;
	}

	public String getSourceFileNameExtension() {
		if(sourceFileNameExtension==null) sourceFileNameExtension = "";
		return sourceFileNameExtension;
	}

	public void setSourceFileNameExtension(String sourceFileNameExtension) {
		this.sourceFileNameExtension = sourceFileNameExtension;
	}

	public Template getFreeMarkerTemplate() {
		return freeMarkerTemplate;
	}

	public void setFreeMarkerTemplate(Template freeMarkerTemplate) {
		this.freeMarkerTemplate = freeMarkerTemplate;
	}

}
